﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;

namespace SafeCalculations
{
    /// <summary>
    /// Represents an average of int32 values exactly. The average consists of an integer part and a fraction where the fraction is given in terms of its numerator and denominator. Adding the integer part to the fraction yields the average.
    /// </summary>
    public class ExactAverage
    {
        /// <summary>
        /// The integer part of the average
        /// </summary>
        public readonly int IntegerPart;

        /// <summary>
        /// The numerator of the fractional part of the average.
        /// </summary>
        public readonly BigInteger RemainderNumerator;

        /// <summary>
        /// The denominator of the fractional part of the average.
        /// </summary>
        public readonly BigInteger RemainderDenominator;

        public ExactAverage(int integerPart, BigInteger remainderNumerator, BigInteger remainderDenominator)
        {
            this.IntegerPart = integerPart;
            this.RemainderNumerator = remainderNumerator;
            this.RemainderDenominator = remainderDenominator;
        }
    }
}
